package com.hxzy.research.controller.adminresearch;

import com.hxzy.research.pojo.ShowCheck1;
import com.hxzy.research.pojo.ShowCheckQq;
import com.hxzy.research.service.pageandmanager.PageBranch;
import com.hxzy.research.service.research.CheckService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;
import java.util.List;


@Controller
public class CompCheckController {
    /**
     * 综合
     */
    @Autowired
    private PageBranch pageBranch;
    @Autowired private CheckService checkService;
    @RequestMapping("/admin/forwardR3List.go")
    public String forwardR3List(Model model)throws Exception{
        //查询分公司列表
        model.addAttribute("branchList",pageBranch.findAllBranch());
        //先跳到点击查询分公司页面
        return "admin/research/r3checkList";
    }
    //根据分公司id和月份查询分公司数据
    @RequestMapping("/admin/getR3List.go")
    public String getR3List(Model model, ShowCheckQq showCheckQq, HttpSession session)throws Exception{
        //查询分公司列表
        session.setAttribute("time",showCheckQq.getMonth());

        model.addAttribute("branchList",pageBranch.findAllBranch());
        List<ShowCheck1> r3list=checkService.findR3ListByMonthAndBranchId(showCheckQq);
        model.addAttribute("r3list",r3list);

        return "admin/research/r3checkList";
    }
    //查看建议分公司-建议1，对公司的建议
    @RequestMapping("/admin/getR3Suggest_1.go")
    public String getR3Suggest_1(Model model,ShowCheckQq showCheckQq,HttpSession session)throws Exception{
        showCheckQq.setMonth((String) session.getAttribute("time"));
        model.addAttribute("suggestList",checkService.findJy3_1List(showCheckQq));
        return "admin/research/r3SuggestView";
    }
    //查看建议分公司-建议2，对老师的建议
    @RequestMapping("/admin/getR3Suggest_2.go")
    public String getR3Suggest_2(Model model,ShowCheckQq showCheckQq,HttpSession session)throws Exception{
        showCheckQq.setMonth((String) session.getAttribute("time"));
        model.addAttribute("suggestList",checkService.findJy3_2List(showCheckQq));
        return "admin/research/r3SuggestView";
    }

    //根据月份查询分公司总体数据
    @RequestMapping("/admin/getAllR3List.go")
    public String getAllR3List(Model model,String month,Integer branchId, HttpSession session)throws Exception{
        //查询分公司列表
        session.setAttribute("time",month);
        session.setAttribute("branchid",branchId);
        model.addAttribute("branchList",pageBranch.findAllBranch());
        //查询总体数据
        List<ShowCheck1> r3list=checkService.findAllR3ListByMonth(month);
        model.addAttribute("r3list",r3list);
        return "admin/research/r3AllcheckList";
    }

    //查询分公司总体数据de建议-1,对公司的建议
    @RequestMapping("admin/getAllR3Suggest_1.go")
    public String getAllR3Suggest_1(Model model,ShowCheckQq showCheckQq,HttpSession session)throws Exception{
        //showCheckQq.setMonth((String) session.getAttribute("time"));
        model.addAttribute("suggestList",checkService.findJy3_1AllList(showCheckQq));
        return "admin/research/r3SuggestView";
    }
    //查询分公司总体数据de建议-2,对老师的建议
    @RequestMapping("admin/getAllR3Suggest_2.go")
    public String getAllR3Suggest_2(Model model,ShowCheckQq showCheckQq,HttpSession session)throws Exception{
        //showCheckQq.setMonth((String) session.getAttribute("time"));
        model.addAttribute("suggestList",checkService.findJy3_2AllList(showCheckQq));
        return "admin/research/r3SuggestView";
    }


}
